package repository

import (
	"github.com/RaymondCode/simple-demo/entity/po"
	"gorm.io/gorm"
	"time"
)

type Video interface {
	// Insert 插入视频
	Insert(tx *gorm.DB, video *po.Video, isTx bool) error
	// QueryBatchByIds 根据ID批量查询视频
	QueryBatchByIds(videoIds *[]int, size int) ([]po.Video, error)
	// QueryByConditionTimeDESC 条件查询视频并按照时间倒序排列
	QueryByConditionTimeDESC(condition *po.Video) (*[]po.Video, error)
	// QueryByLatestTimeDESC 查询某个时间点之前的视频，倒序排列
	QueryByLatestTimeDESC(latestTime time.Time, size int) (*[]po.Video, error)
	// QueryById 根据ID查询视频
	QueryById(id int) (*po.Video, error)
	// UpdateByCondition 条件更新
	UpdateByCondition(video *po.Video, tx *gorm.DB, isTx bool) error
	// QueryVideosByUserId 根据用户ID查询视频
	QueryVideosByUserId(userId int) (*[]po.Video, error)
	// ChangeFavoriteCount 修改点赞数量
	ChangeFavoriteCount(difference, videoId int, tx *gorm.DB, isTx bool) error
	// ChangeCommentCount 修改评论数量
	ChangeCommentCount(difference, videoId int, tx *gorm.DB, isTx bool) error
}
